﻿using System;
using System.Web;
using WF.Common;

//this page create for gsl
namespace WF.Web.Pages
{
    public class HrBasePage : System.Web.UI.Page
    {
        public UserProfile Profile
        {
            get { return (UserProfile)Session[SessionKeys.CurrentUser]; }
        }

        public bool Valid
        {
            get
            {
                bool flag = false;
                string hrBlockLimite = new ConfigHelper().HrBlockLimite;
                string[] arHrBlockLimite = hrBlockLimite.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                if (Profile != null)
                    foreach (string deptCode in arHrBlockLimite)
                    {
                        if (Profile.DeptPath == deptCode)
                        {
                            flag = true;
                            break;
                        }
                    }
                return flag;
            }
        }

        protected void Page_Init(object sender, EventArgs e)
        {
            if (!Valid)
            {
                Response.Write("您无权访问此页");
                Response.End();
            }

        }
    }
}